<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/13
 * Time: 15:51
 */

if (!defined('IN_IA')) {
    exit('Access Denied');
}

class Store_MxShopPage extends WebPage {

    public function main(){

        global $_W,$_GPC;
        $id = intval($_GPC['id']);

        if(empty($id)){
            show_json(0,'参数有误！');
        }
        $platform = pdo_fetch("SELECT * FROM " . tablename('mx_shop_platform') . " WHERE platformid=:platformid", array('platformid'=>$id));

        $setting = m('platform')->getSetting($id);
        $setting = unserialize($setting['data']);

        if ($_W['ispost']) {

            $data = array();
            $data['banner'] = serialize($_GPC['banner']);

            $setting['store'] = $data;
            //企业设置
            $res = m('platform')->setSetting($id, $setting);
            if(!$res){
                show_json(0, '设置失败');
            }

            plog('platform.manage.store', '更新企业设置成功！平台ID为' . $id);

            show_json(1);
        }

        $item = $setting['store'];
        $item['banner'] = unserialize($item['banner']);

        include $this->template();
    }
}
